﻿@page
@model IndexModel
@{
    Layout = "Shared/_Layout";
    ViewData["Title"] = "控制台";
}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开启头部工具栏</div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="afc-table" lay-filter="afc-table-toolbar"></table>

                    <script type="text/html" id="afc-table-toolbar">
                        <div class="layui-btn-container">
                            <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
                            <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
                            <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
                        </div>
                    </script>

                    <script type="text/html" id="afc-table-toolbar-bar">
                        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

@section Scripts
{
    <script>
        layui.use(['index', 'table'],
            function() {
                const admin = layui.admin;
                const table = layui.table;

                table.render({
                    elem: '#afc-table',
                    toolbar: '#afc-table-toolbar',
                    url: 'https://localhost:44309/api/ActionLogInfos/GetList',
                    title: '系统日志',
                    page: true,
                    cols: [[
                        { type: 'checkbox', fixed: 'left' },
                        { field: 'id', title: 'ID', width: 80, fixed: 'left', unresize: true, sort: true },
                        { field: 'moduleName', title: '控制器名称', width: 120 },
                        { field: 'actionName', title: '方法名称', width: 150 },
                        { field: 'preUrl', title: '上级链接', width: 80, sort: true },
                        { field: 'actionUrl', title: '方法链接', width: 100 },
                        { field: 'duration', title: '方法执行时间' },
                        { field: 'internetProtocol', title: '访问者IP地址', width: 80, sort: true },
                        { field: 'userAgent', title: '访问者用户代理', width: 120 },
                        { field: 'logType', title: '日志类型', width: 100, sort: true },
                        { field: 'createTime', title: '创建时间', width: 120 },
                        { fixed: 'right', title: '操作', toolbar: '#afc-table-toolbar-bar', width: 150 }
                    ]]
                });
            });
    </script>
}